<?php
namespace app\index\controller;

use think\Controller;

class Casus extends Common
{
    public function _initialize()
    {
        parent::_initialize();
        $this->assign('active', '合作案例');
        $url = '/c_list';
        $this->assign('nav_image', get_nav_img($url));
    }

    // 合作案例页面
    public function index() {
        $casus = db('casus')->alias('c')->field('c.*, cc.info')
            ->join('osl_casus_content cc', 'c.id = cc.casus_id', 'LEFT')
            ->order('c.id desc')->paginate(6);

        $this->assign('casus', $casus);
        return view();
    }

    // 合作案例详情
    public function casus_details() {
        $id = input('param.id');
        $casus = db('casus')->alias('c')
            ->field('c.*, cc.content')
            ->join('osl_casus_content cc', 'c.id = cc.casus_id', 'LEFT')
            ->where('c.id', $id)
            ->find();
        $this->assign('casus', $casus);
        return view();
    }
}
